import { createRouter, createWebHashHistory } from 'vue-router'

import Layout from "../layout/index.vue"

const routes = [
    {
        path: '/login',
        name: 'Login',
        component: () => import('../views/Login.vue'),
        meta: { title: '登录', hidden: true }
    },
    {
        path: '/',
        component: Layout,
        redirect: '/dashboard',
        meta: { title: '首页', icon: 'House', hidden: false },
        children: [
            {
                path: 'dashboard',
                name: 'Dashboard',
                component: () => import('../views/dashboard/index.vue'),
                meta: { title: '首页', icon: 'House', hidden: false }
            }

        ]
    },

    {
        path: '/404',
        name: '404',
        component: () => import('../views/404.vue'),
        meta: {
            title: '404',
            hidden: true // 在菜单中隐藏
        }
    },
    // {
    //     path: '/:pathMatch(.*)*',
    //     redirect: '/404'
    // }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router